package com.itholmes.config;

import com.itholmes.listener.MyListener;
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

//@Configuration 使用了启动器就没必要使用监听器了。
public class MyServletConfig {

    //将自己的servlet添加进容器
    @Bean
    public ServletListenerRegistrationBean getMyListener(){
        //传入自己的监听器
        ServletListenerRegistrationBean servletListenerRegistrationBean = new ServletListenerRegistrationBean(new MyListener());
        return servletListenerRegistrationBean;
    }

}
